using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.H_MySpaceTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HL_MySpaceTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HL_MySpaceTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HL_MySpace";
			dataTableMapping.ColumnMappings.Add("ID", "ID");
			dataTableMapping.ColumnMappings.Add("UserID", "UserID");
			dataTableMapping.ColumnMappings.Add("ClassID", "ClassID");
			dataTableMapping.ColumnMappings.Add("ClassName", "ClassName");
			dataTableMapping.ColumnMappings.Add("onTop", "onTop");
			dataTableMapping.ColumnMappings.Add("Passed", "Passed");
			dataTableMapping.ColumnMappings.Add("IsElite", "IsElite");
			dataTableMapping.ColumnMappings.Add("Hits", "Hits");
			dataTableMapping.ColumnMappings.Add("OrderNum", "OrderNum");
			dataTableMapping.ColumnMappings.Add("RssUrl", "RssUrl");
			dataTableMapping.ColumnMappings.Add("RssNum", "RssNum");
			dataTableMapping.ColumnMappings.Add("UpdateTime", "UpdateTime");
			dataTableMapping.ColumnMappings.Add("ArticleID", "ArticleID");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HL_MySpace] WHERE (([ID] = @Original_ID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_ID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HL_MySpace] ([UserID], [ClassID], [ClassName], [onTop], [Passed], [IsElite], [Hits], [OrderNum], [RssUrl], [RssNum], [UpdateTime], [ArticleID]) VALUES (@UserID, @ClassID, @ClassName, @onTop, @Passed, @IsElite, @Hits, @OrderNum, @RssUrl, @RssNum, @UpdateTime, @ArticleID)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClassID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ClassID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ClassName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@onTop", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "onTop", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Passed", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "Passed", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@IsElite", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "IsElite", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Hits", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "Hits", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OrderNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OrderNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RssUrl", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "RssUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@RssNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RssNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UpdateTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "UpdateTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ArticleID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ArticleID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HL_MySpace] SET [UserID] = @UserID, [ClassID] = @ClassID, [ClassName] = @ClassName, [onTop] = @onTop, [Passed] = @Passed, [IsElite] = @IsElite, [Hits] = @Hits, [OrderNum] = @OrderNum, [RssUrl] = @RssUrl, [RssNum] = @RssNum, [UpdateTime] = @UpdateTime, [ArticleID] = @ArticleID WHERE (([ID] = @Original_ID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClassID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ClassID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ClassName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ClassName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@onTop", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "onTop", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Passed", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "Passed", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsElite", SqlDbType.Bit, 0, ParameterDirection.Input, 0, 0, "IsElite", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Hits", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "Hits", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OrderNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "OrderNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RssUrl", SqlDbType.Text, 0, ParameterDirection.Input, 0, 0, "RssUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@RssNum", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "RssNum", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "UpdateTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ArticleID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ArticleID", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_ID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "ID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[6];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT ID, UserID, ClassID, ClassName, onTop, Passed, IsElite, Hits, OrderNum, RssUrl, \r\n      RssNum, UpdateTime, ArticleID\r\nFROM HL_MySpace";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "DELETE FROM [HL_MySpace] WHERE (([ID] = @ID))";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "DELETE FROM [HL_MySpace] WHERE (([UserID] = @User_ID))";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@User_ID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT HL_MySpace.ID, HL_MySpace.UserID, HL_MySpace.ClassID, \r\n      HL_MySpace.ClassName, HL_MySpace.onTop, HL_MySpace.Passed, \r\n      HL_MySpace.IsElite, HL_MySpace.Hits, HL_MySpace.OrderNum, \r\n      HL_MySpace.RssUrl, HL_MySpace.RssNum, HL_MySpace.UpdateTime, \r\n      HL_MySpace.ArticleID, HL_User.UserName\r\nFROM HL_MySpace INNER JOIN\r\n      HL_User ON HL_MySpace.UserID = HL_User.UserID";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[4] = new SqlCommand();
			this._commandCollection[4].Connection = this.Connection;
			this._commandCollection[4].CommandText = "SELECT ID, UserID, ClassID, ClassName, onTop, Passed, IsElite, Hits, OrderNum, RssUrl, \r\n      RssNum, UpdateTime, ArticleID\r\nFROM HL_MySpace\r\nWHERE UserID=@UserID";
			this._commandCollection[4].CommandType = CommandType.Text;
			this._commandCollection[4].Parameters.Add(new SqlParameter("@UserID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "UserID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[5] = new SqlCommand();
			this._commandCollection[5].Connection = this.Connection;
			this._commandCollection[5].CommandText = "SELECT ID, UserID, ClassID, ClassName, onTop, Passed, IsElite, Hits, OrderNum, RssUrl, \r\n      RssNum, UpdateTime, ArticleID\r\nFROM HL_MySpace\r\nWHERE ID=@ID";
			this._commandCollection[5].CommandType = CommandType.Text;
			this._commandCollection[5].Parameters.Add(new SqlParameter("@ID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "ID", DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_MySpace.HL_MySpaceDataTable GetAllRss()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			H_MySpace.HL_MySpaceDataTable hL_MySpaceDataTable = new H_MySpace.HL_MySpaceDataTable();
			this.Adapter.Fill(hL_MySpaceDataTable);
			return hL_MySpaceDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_MySpace.HL_MySpaceDataTable GetAllRssContenUserName()
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			H_MySpace.HL_MySpaceDataTable hL_MySpaceDataTable = new H_MySpace.HL_MySpaceDataTable();
			this.Adapter.Fill(hL_MySpaceDataTable);
			return hL_MySpaceDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_MySpace.HL_MySpaceDataTable GetMyRssByUserID(int? UserID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[4];
			if (UserID.HasValue)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = UserID.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			H_MySpace.HL_MySpaceDataTable hL_MySpaceDataTable = new H_MySpace.HL_MySpaceDataTable();
			this.Adapter.Fill(hL_MySpaceDataTable);
			return hL_MySpaceDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_MySpace.HL_MySpaceDataTable GetRSSByID(int ID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[5];
			this.Adapter.SelectCommand.Parameters[0].Value = ID;
			H_MySpace.HL_MySpaceDataTable hL_MySpaceDataTable = new H_MySpace.HL_MySpaceDataTable();
			this.Adapter.Fill(hL_MySpaceDataTable);
			return hL_MySpaceDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_MySpace.HL_MySpaceDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_MySpace dataSet)
		{
			return this.Adapter.Update(dataSet, "HL_MySpace");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteRss(int ID)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			sqlCommand.Parameters[0].Value = ID;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteRssByUserID(int? User_ID)
		{
			SqlCommand sqlCommand = this.CommandCollection[2];
			if (User_ID.HasValue)
			{
				sqlCommand.Parameters[0].Value = User_ID.Value;
			}
			else
			{
				sqlCommand.Parameters[0].Value = System.DBNull.Value;
			}
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
